{extend name="layout" /}
{block name="css"}
<!-- ================== BEGIN PAGE LEVEL STYLE ================== -->
<link href="artisan_plugins/DataTables/css/data-table.css" rel="stylesheet"/>
<link href="artisan_plugins/switchery/switchery.min.css" rel="stylesheet"/>
<link href="artisan_plugins/powerange/powerange.min.css" rel="stylesheet"/>
<!-- ================== END PAGE LEVEL STYLE ================== -->
<style type="text/css">
    #data-table_paginate, #data-table_info {display: none;}
    td {font-size: 13px;}
</style>
{/block}
{block name="content"}
<div class="content">
    <!-- begin breadcrumb -->
    <ol class="breadcrumb pull-right">
        <li><a href="{:url('Admin/Index/index')}">首页</a></li>
        <li><a href="javascript:;">用户管理</a></li>
        <li class="active">所有用户</li>
    </ol>
    <!-- end breadcrumb -->
    <!-- begin page-header -->
    <h1 class="page-header">所有用户
        <small></small>
    </h1>
    <!-- end page-header -->
    <div class="col-md-12">
        <div class="panel panel-inverse" data-sortable-id="index-1">
            <div class="panel-heading">
                <div class="panel-heading-btn">
                    <a href="javascript:;" class="btn btn-xs btn-icon btn-circle btn-default" data-click="panel-expand"><i
                            class="fa fa-expand"></i></a>
                    <a href="javascript:;" class="btn btn-xs btn-icon btn-circle btn-success" data-click="panel-reload"><i
                            class="fa fa-repeat"></i></a>
                    <a href="javascript:;" class="btn btn-xs btn-icon btn-circle btn-warning"
                       data-click="panel-collapse"><i class="fa fa-minus"></i></a>
                    <a href="javascript:;" class="btn btn-xs btn-icon btn-circle btn-danger"
                       data-click="panel-remove"><i class="fa fa-times"></i></a>
                </div>
                <h3 class="panel-title">系统所有用户</h3>
            </div>
            <div class="alert alert-info fade in">
                <button type="button" class="close" data-dismiss="alert">
                    <span aria-hidden="true">&times;</span>
                </button>
                展示当前系统内所有的用户信息
            </div>
            <div class="panel-body">
                <div class="table-responsive">
                    <!-- <div id="interactive-chart" class="height-sm"></div> -->
                    <table id="data-table" class="table table-striped table-bordered nowrap" width="100%">
                        <thead>
                        <tr>
                            <td>用户编号</td>
                            <td>用户名</td>
                            <td>用户邮箱</td>
                            <td>用户角色</td>
                            <td>当前状态</td>
                            <td>删除</td>
                            <td>操作</td>
                        </tr>
                        </thead>
                        <tbody>
                        {volist name="user" id="v"}
                        <tr>
                            <td>{$v.id}</td>
                            <td>{$v.username}</td>
                            <td>{$v.email}</td>
                            {if condition="$v['user_type'] == '1'"}
                            <td><label class="label label-danger">超级管理员</label></td>
                            {elseif condition="$v['user_type'] == '2'"}
                            <td><label class="label label-warning">车间负责</label></td>
                            {elseif condition="$v['user_type'] == '3'"}
                            <td><label class="label label-success">工段负责</label></td>
                            {else/}
                            <td><label class="label label-info">电气室负责</label></td>
                            {/if}
                            {if condition="$v['status'] == '1'"}
                            <td>
                                <label class="label label-success">正常</label></td>
                            {else/}
                            <td><label class="label label-danger">禁用</label></td>
                            {/if}
                            <td>
                                <a href="#modal-dialog1" data-toggle="modal">
                                    <i class="fa fa-trash-o">删除</i> </a>
                                <!-- 删除 -->
                                <div class="modal fade" id="modal-dialog1">
                                    <div class="modal-dialog">
                                        <div class="modal-content">
                                            <div class="modal-header">
                                                <button type="button" class="close" data-dismiss="modal"
                                                        aria-hidden="true">×
                                                </button>
                                                <h4 class="modal-title">警告</h4>
                                            </div>
                                            <div class="modal-body">
                                                <div class="alert alert-danger m-b-0">
                                                    <h4><i class="fa fa-info-circle"></i> 是否确认删除当前用户？</h4>
                                                </div>
                                            </div>
                                            <div class="modal-footer">
                                                <a href="javascript:;" class="btn btn-sm btn-white"
                                                   data-dismiss="modal">关闭</a>
                                                <a href="javascript:;" class="btn btn-sm btn-danger"
                                                   data-dismiss="modal">删除</a>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </td>

                            {if condition="$v.status == '1'"}
                            <td>
                                <a href="{:url('Admin/Users/userinfo',['id' => $v['id']])}">
                                    <i class="fa fa-folder-open">查看</i></a> |
                                <a href="{:url('Admin/Users/upuser',['id' => $v['id']])}">
                                    <i class="fa fa-pencil">编辑</i></a> |
                                <a href="#modal-dialog" style="color:red;" class="email-btn text-danger" data-toggle="modal">
                                    <i class="fa fa-flag">禁用</i></a>
                                <!-- 禁用 -->
                                <div class="modal fade" id="modal-dialog">
                                    <div class="modal-dialog">
                                        <div class="modal-content">
                                            <div class="modal-header">
                                                <button type="button" class="close" data-dismiss="modal"
                                                        aria-hidden="true">×
                                                </button>
                                                <h4 class="modal-title">警告</h4>
                                            </div>
                                            <div class="modal-body">
                                                <div class="alert alert-danger m-b-0">
                                                    <h4><i class="fa fa-info-circle"></i> 是否确认禁用当前用户？</h4>
                                                </div>
                                            </div>
                                            <div class="modal-footer">
                                                <a href="javascript:;" class="btn btn-sm btn-white"
                                                   data-dismiss="modal">关闭</a>
                                                <a href="{:url('Admin/Users/forbiduser',['id' => $v['id']])}"
                                                   class="btn btn-sm btn-danger">禁用</a>
                                            </div>
                                        </div>
                                    </div>
                                </div>


                            </td>
                            {else/}
                            <td><a href="{:url('Admin/Users/userinfo',['id' => $v['id']])}"><i
                                    class="fa fa-folder-open">查看</i></a> | <a
                                    href="{:url('Admin/Users/upuser',['id' => $v['id']])}"><i
                                    class="fa fa-pencil">编辑</i></a> | <a href="#modal-dialog3" data-toggle="modal"><i
                                    class="fa fa-flag">启用</i></a>
                                <!-- 启用 -->
                                <div class="modal fade" id="modal-dialog3">
                                    <div class="modal-dialog">
                                        <div class="modal-content">
                                            <div class="modal-header">
                                                <button type="button" class="close" data-dismiss="modal"
                                                        aria-hidden="true">×
                                                </button>
                                                <h4 class="modal-title">提示：</h4>
                                            </div>
                                            <div class="modal-body">
                                                是否确认启用当前用户？
                                            </div>
                                            <div class="modal-footer">
                                                <a href="javascript:;" class="btn btn-sm btn-white"
                                                   data-dismiss="modal">关闭</a>
                                                <a href="{:url('Admin/Users/allowuser',['id' => $v['id']])}"
                                                   class="btn btn-sm btn-danger">启用</a>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </td>
                            {/if}
                        </tr>
                        {/volist}

                        </tbody>
                    </table>
                    <div class="col-md-9"></div>
                    <div class="col-md-3" style="margin:0px;padding: 0px;"><p class="pull-right">{$user->render()}</p>
                    </div>
                    <!-- #modal-dialog -->


                </div>
            </div>


        </div>

    </div>
</div>
{/block}
{block name="script"}
<!-- ================== BEGIN PAGE LEVEL JS ================== -->
<script src="artisan_plugins/DataTables/js/jquery.dataTables.js"></script>
<script src="artisan_plugins/DataTables/js/dataTables.tableTools.js"></script>
<script src="artisan_js/table-manage-tabletools.demo.min.js"></script>
<script src="artisan_plugins/switchery/switchery.min.js"></script>
<script src="artisan_plugins/powerange/powerange.min.js"></script>
<script src="artisan_js/form-slider-switcher.demo.min.js"></script>
<script src="artisan_js/apps.min.js"></script>
<!-- ================== END PAGE LEVEL JS ================== -->
<script>
    $(document).ready(function () {
        TableManageTableTools.init();
    });
</script>
{/block}